<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="产业集群" prop="bussEconomic">
        <el-select v-model="queryParams.bussEconomic" placeholder="请选择产业集群" clearable>
          <el-option
            v-for="dict in dict.type.industry_orientation"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="所属城市" prop="wareName"><!--todo:省市二级联查-->
        <el-select v-model="queryParams.provinceId" placeholder="请选择省份"
                   @change="getCityList(queryParams.provinceId)"
                   style="width: 108px"
                   clearable>
          <el-option
            v-for="dict in provinces"
            :key="dict.id"
            :label="dict.name"
            :value="dict.id"
          />
        </el-select>
        <el-select v-model="queryParams.cityId" placeholder="请选择城市"
                   :disabled="queryParams.provinceId==null||queryParams.provinceId===''"
                   style="width: 107px"
                   clearable>
          <el-option
            v-for="dict in citys"
            :key="dict.id"
            :label="dict.name"
            :value="dict.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="园区类型" prop="parkType">
        <el-select v-model="queryParams.parkType" placeholder="请选择园区类型" clearable>
          <el-option
            v-for="dict in dict.type.park_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="仓库名称" prop="wareName">
        <el-input
          v-model="queryParams.wareName"
          placeholder="请输入仓库名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--      <el-form-item label="发布类型" prop="releaseType">-->
      <!--        <el-select v-model="queryParams.releaseType" placeholder="请选择发布类型" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.announce_type"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <el-form-item label="需求类型" prop="supplyType">
        <el-select v-model="queryParams.supplyType" placeholder="请选择需求类型" clearable>
          <el-option
            v-for="dict in dict.type.need_mode"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="预期价格" prop="wareSellPrice">
        <!--        <el-input
                  v-model="queryParams.wareSellPrice"
                  placeholder="请输入预期价格"
                  clearable
                  @keyup.enter.native="handleQuery"
                />-->
        <el-select v-model="queryParams.buildSellPrice" placeholder="请选择预期价格" clearable>
          <el-option
            v-for="dict in dict.type.selling_price"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="仓库名称" prop="wareName">
              <el-input
                v-model="queryParams.wareName"
                placeholder="请输入仓库名称"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>-->
      <el-form-item label="预期价格" prop="wareLeasePrice">
        <!--        <el-input
                  v-model="queryParams.wareLeasePrice"
                  placeholder="请输入预期价格"
                  clearable
                  @keyup.enter.native="handleQuery"
                />-->
        <el-select v-model="queryParams.buildLeasePrice" placeholder="请选择预期价格" clearable>
          <el-option
            v-for="dict in dict.type.rental_price"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="预期价格" prop="wareSellPrice">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareSellPrice"-->
      <!--          placeholder="请输入预期价格"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="总面积" prop="wareAllSize">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareAllSize"-->
      <!--          placeholder="请输入总面积"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="空置面积" prop="workFreeSize">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.workFreeSize"-->
      <!--          placeholder="请输入空置面积"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="所在楼层" prop="wareFloor">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareFloor"-->
      <!--          placeholder="请输入所在楼层"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="层高" prop="wareFloorHeight">-->
      <!--        <el-select v-model="queryParams.wareFloorHeight" placeholder="请选择层高" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.floor_height"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="首层承重" prop="wareFirstLoad">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareFirstLoad"-->
      <!--          placeholder="请输入首层承重"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="标准层承重" prop="wareLoad">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareLoad"-->
      <!--          placeholder="请输入标准层承重"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="设施" prop="wareFacili">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareFacili"-->
      <!--          placeholder="请输入设施"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="货梯" prop="wareElevatorCargo">-->
      <!--        <el-select v-model="queryParams.wareElevatorCargo" placeholder="请选择货梯" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.sys_have_not"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="货梯负载" prop="wareElevatorCargoLoad">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareElevatorCargoLoad"-->
      <!--          placeholder="请输入货梯负载"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item label="应急系统" prop="wareEmergency">
        <el-select v-model="queryParams.wareEmergency" placeholder="请选择应急系统" clearable>
          <el-option
            v-for="dict in dict.type.sys_have_not"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="审核状态" prop="approvalState">
        <el-select v-model="queryParams.approvalState" placeholder="请选择审核状态" clearable>
          <el-option
            v-for="dict in dict.type.audit_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="供暖" prop="wareHeating">-->
      <!--        <el-select v-model="queryParams.wareHeating" placeholder="请选择供暖" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.heating_system"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="制冷" prop="wareRefrig">-->
      <!--        <el-select v-model="queryParams.wareRefrig" placeholder="请选择制冷" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.refrigerating_system"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="电量" prop="warePower">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.warePower"-->
      <!--          placeholder="请输入电量"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="水" prop="wareWater">-->
      <!--        <el-select v-model="queryParams.wareWater" placeholder="请选择水" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.water_system"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="区域位置" prop="parkAreaAddress">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.parkAreaAddress"-->
      <!--          placeholder="请输入区域位置"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="需求面积" prop="wareNeedSize">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.wareNeedSize"-->
      <!--          placeholder="请输入需求面积"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="所属城市ID" prop="cityId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.cityId"-->
      <!--          placeholder="请输入所属城市ID"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="浏览量" prop="pageView">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.pageView"-->
      <!--          placeholder="请输入浏览量"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否收藏0否1是" prop="collectState">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.collectState"-->
      <!--          placeholder="请输入是否收藏0否1是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否明星推荐0否1是" prop="recState">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.recState"-->
      <!--          placeholder="请输入是否明星推荐0否1是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="预定状态0未预定1已预定" prop="reserveState">-->
      <!--        <el-select v-model="queryParams.reserveState" placeholder="请选择预定状态0未预定1已预定" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.sys_yes_no"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="明星推荐状态0否1是" prop="recomState">-->
      <!--        <el-select v-model="queryParams.recomState" placeholder="请选择明星推荐状态0否1是" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.sys_yes_no"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="联系人" prop="contactName">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.contactName"-->
      <!--          placeholder="请输入联系人"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="联系方式" prop="servicePhone">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.servicePhone"-->
      <!--          placeholder="请输入联系方式"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="联系方式" prop="contactPhone">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.contactPhone"-->
      <!--          placeholder="请输入联系方式"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="发布人用户ID" prop="supplyUserId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.supplyUserId"-->
      <!--          placeholder="请输入发布人用户ID"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="审核状态：0待审核1审核通过2审核失败" prop="approvalState">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.approvalState"-->
      <!--          placeholder="请输入审核状态：0待审核1审核通过2审核失败"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="审核备注" prop="approvalNote">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.approvalNote"-->
      <!--          placeholder="请输入审核备注"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="园区ID" prop="parkId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.parkId"-->
      <!--          placeholder="请输入园区ID"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="备注" prop="note">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.note"-->
      <!--          placeholder="请输入备注"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="排序" prop="sort">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.sort"-->
      <!--          placeholder="请输入排序"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="状态0有效1失效" prop="state">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.state"-->
      <!--          placeholder="请输入状态0有效1失效"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否删除0否1是" prop="dr">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.dr"-->
      <!--          placeholder="请输入是否删除0否1是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否置顶0：否1：是" prop="top">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.top"-->
      <!--          placeholder="请输入是否置顶0：否1：是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['myIndustry:warehouse:add']"
        >新增</el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="success"-->
      <!--          plain-->
      <!--          icon="el-icon-edit"-->
      <!--          size="mini"-->
      <!--          :disabled="single"-->
      <!--          @click="handleUpdate"-->
      <!--          v-hasPermi="['myIndustry:warehouse:edit']"-->
      <!--        >修改</el-button>-->
      <!--      </el-col>-->
            <el-col :span="1.5">
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                size="mini"
                :disabled="multiple"
                @click="handleDelete"
                v-hasPermi="['myIndustry:warehouse:remove']"
              >删除</el-button>
            </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['myIndustry:warehouse:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="warehouseList" @selection-change="handleSelectionChange" height="410" fixed>
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="用户ID" align="center" prop="id" />
      <el-table-column label="仓库名称" align="center" prop="wareName" />
      <el-table-column label="需求类型" align="center" prop="supplyType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.need_mode" :value="scope.row.supplyType ? scope.row.supplyType.split(',') : []"/>
        </template>
      </el-table-column>
      <el-table-column label="关联园区" align="center" prop="parkName" />
      <el-table-column label="预期价格" align="center" prop="wareLeasePrice" />
      <el-table-column label="预期价格" align="center" prop="wareSellPrice" />
      <el-table-column label="建筑面积" align="center" prop="wareAllSize" />
      <el-table-column label="空置面积" align="center" prop="workFreeSize" />
      <el-table-column label="层高" align="center" prop="wareFloorHeight">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.floor_height" :value="scope.row.wareFloorHeight"/>
        </template>
      </el-table-column>
      <el-table-column label="首层承重" align="center" prop="wareFirstLoad" />
      <el-table-column label="标准层承重" width="120" align="center" prop="wareLoad" />
      <el-table-column label="设施" align="center" prop="wareFacili" />
      <el-table-column label="货梯" align="center" prop="wareElevatorCargo">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_have_not" :value="scope.row.wareElevatorCargo"/>
        </template>
      </el-table-column>
      <el-table-column label="货梯负载" align="center" prop="wareElevatorCargoLoad" />
      <el-table-column label="消防设施" align="center" prop="wareFireControl">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.fire_fighting_device" :value="scope.row.wareFireControl ? scope.row.wareFireControl.split(',') : []"/>
        </template>
      </el-table-column>
      <el-table-column label="应急系统" align="center" prop="wareEmergency">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_have_not" :value="scope.row.wareEmergency"/>
        </template>
      </el-table-column>
      <!--      <el-table-column label="供暖" align="center" prop="wareHeating">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.heating_system" :value="scope.row.wareHeating"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="制冷" align="center" prop="wareRefrig">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.refrigerating_system" :value="scope.row.wareRefrig"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="电量" align="center" prop="warePower" />-->
      <!--      <el-table-column label="燃气" align="center" prop="wareGas">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.gas_system" :value="scope.row.wareGas ? scope.row.wareGas.split(',') : []"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="水" align="center" prop="wareWater">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.water_system" :value="scope.row.wareWater"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="园区类别" align="center" prop="parkType" />-->
      <!--      <el-table-column label="区域位置" align="center" prop="parkAreaAddress" />-->
      <!--      <el-table-column label="需求面积" align="center" prop="wareNeedSize" />-->
      <!--      <el-table-column label="所属城市ID" align="center" prop="cityId" />-->
      <!--      <el-table-column label="发布类型0供给1需求" align="center" prop="releaseType" />-->
      <!--      <el-table-column label="浏览量" align="center" prop="pageView" />-->
      <!--      <el-table-column label="是否收藏0否1是" align="center" prop="collectState" />-->
      <!--      <el-table-column label="是否明星推荐0否1是" align="center" prop="recState" />-->
      <!--      <el-table-column label="预定状态0未预定1已预定" align="center" prop="reserveState">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.reserveState"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="明星推荐状态0否1是" align="center" prop="recomState">-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.recomState"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="图片资源" align="center" prop="imgResource" width="100">-->
      <!--      <template slot-scope="scope">-->
      <!--        <image-preview :src="scope.row.imgResource" :width="50" :height="50"/>-->
      <!--      </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="封面资源http:p1" align="center" prop="coverResource" width="100">-->
      <!--        <template slot-scope="scope">-->
      <!--          <image-preview :src="scope.row.coverResource" :width="50" :height="50"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="VR资源" align="center" prop="vrResource" />-->
      <!--      <el-table-column label="联系人" align="center" prop="contactName" />-->
      <!--      <el-table-column label="联系方式" align="center" prop="servicePhone" />-->
      <!--      <el-table-column label="联系方式" align="center" prop="contactPhone" />-->
      <!--      <el-table-column label="发布人用户ID" align="center" prop="supplyUserId" />-->
      <!--      <el-table-column label="审核状态：0待审核1审核通过2审核失败" align="center" prop="approvalState" />-->
      <!--      <el-table-column label="审核备注" align="center" prop="approvalNote" />-->
      <!--      <el-table-column label="园区ID" align="center" prop="parkId" />-->
      <!--      <el-table-column label="备注" align="center" prop="note" />-->
      <!--      <el-table-column label="排序" align="center" prop="sort" />-->
      <!--      <el-table-column label="状态0有效1失效" align="center" prop="state" />-->
      <!--      <el-table-column label="是否删除0否1是" align="center" prop="dr" />-->
      <!--      <el-table-column label="VR封面" align="center" prop="vrcover" width="100">-->
      <!--        <template slot-scope="scope">-->
      <!--          <image-preview :src="scope.row.vrcover" :width="50" :height="50"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <!--      <el-table-column label="是否置顶0：否1：是" align="center" prop="top" />-->
      <el-table-column width="220" label="操作" align="center" class-name="small-padding fixed-width"  fixed="right">
        <template slot-scope="scope">
          <el-row>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleLook(scope.row)"
            >预览
            </el-button>
              <el-button
                style=""
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['myIndustry:warehouse:edit']"
              >修改</el-button>
              <el-button
                style=""
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['myIndustry:warehouse:remove']"
              >删除</el-button>
<!--            <el-col :span="1.5">-->
<!--              <el-button-->
<!--                type="warning"-->
<!--                plain-->
<!--                icon="el-icon-download"-->
<!--                size="mini"-->
<!--                @click="handleExport"-->
<!--                v-hasPermi="['myIndustry:warehouse:export']"-->
<!--              >导出-->
<!--              </el-button>-->
<!--            </el-col>-->
          </el-row>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改仓库对话框 -->
    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="759px" append-to-body center>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px" class="float-centered"
               style="margin-left: 2%; margin-right: 2%">
        <el-form-item label="仓库名称" prop="wareName" >
          <el-input v-model="form.wareName" placeholder="请输入仓库名称" maxlength="50"/>
        </el-form-item>
        <el-row>
          <el-col :span="24">
            <el-form-item label="供给类型" prop="supplyType">
              <el-checkbox-group v-model="form.supplyType">
                <el-checkbox
                  v-for="dict in dict.type.need_mode"
                  :key="dict.value"
                  :label="dict.value">
                  {{ dict.label }}
                </el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <!--            <el-form-item label="发布类型" prop="releaseType">-->
            <!--              <el-select v-model="form.releaseType" placeholder="请选择发布类型" @change ='updateRelease(form.releaseType)' style="width: 100%">-->
            <!--                <el-option-->
            <!--                  v-for="dict in dict.type.announce_type"-->
            <!--                  :key="dict.value"-->
            <!--                  :label="dict.label"-->
            <!--                  :value="parseInt(dict.value)"-->
            <!--                ></el-option>-->
            <!--              </el-select>-->
            <!--            </el-form-item>-->
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item :label="form.releaseType===0?'租赁价格':'预算'" prop="wareLeasePrice">
              <el-input v-model="form.wareLeasePrice" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="50"
                        :placeholder="form.releaseType===0?'请输入租赁价格':'请输入预算价格'">
                <template slot="append">元/m²/天</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="form.releaseType===0?'出售价格':'预期价格'" prop="wareSellPrice">
              <el-input v-model="form.wareSellPrice" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="50"
                        :placeholder="form.releaseType===0?'请输入出售价格':'请输入预期价格'">
                <template slot="append">元/m²</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="期望地段" prop="parkAreaAddress">
          <el-select v-model="form.parkAreaAddress" placeholder="请选择期望地段" style="width: 100%">
            <el-option
              v-for="dict in dict.type.regional_position"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-row>
<!--          <el-col :span="24">
            <el-form-item label="建筑总面积" prop="wareAllSize">
              <el-input v-model="form.wareAllSize" oninput="value=value.replace(/[^0-9.]/g,'')" @change="handleAcreage" maxlength="50"
                        placeholder="请输入建筑总面积">
                <template slot="append">m²</template>
              </el-input>
            </el-form-item>
          </el-col>-->
<!--          <el-col :span="24">
            <el-form-item label="空置面积" prop="workFreeSize">
              <el-input v-model="form.workFreeSize" oninput="value=value.replace(/[^0-9.]/g,'')" @change="handleAcreage" maxlength="50"
                        placeholder="请输入空置面积">
                <template slot="append">m²</template>
              </el-input>
            </el-form-item>
          </el-col>-->
          <el-col :span="24">
            <el-form-item label="需求面积" prop="wareNeedSize" v-if="form.releaseType==1">
              <el-input v-model="form.wareNeedSize" oninput="value=value.replace(/[^0-9.]/g,'')" @change="handleAcreage" maxlength="50"
                        placeholder="请输入需求面积">
                <template slot="append">m²</template>
              </el-input>
            </el-form-item>
          </el-col>
<!--          <el-col :span="24">
            <el-form-item>
              <el-alert
                class="park" title="空置面积大于总面积" v-if="acreage<0" :closable="false" type="error" center show-icon>
              </el-alert>
            </el-form-item>
          </el-col>-->
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="所在楼层" prop="wareFloor">
              <el-input v-model="form.wareFloor" placeholder="请输入所在楼层" maxlength="50"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="层高" prop="wareFloorHeight">
              <el-radio-group v-model="form.wareFloorHeight" style="width: 100%">
                <el-radio
                  v-for="dict in dict.type.floor_height"
                  :key="dict.value"
                  :label="dict.value"
                >{{ dict.label }}
                </el-radio>
                <el-radio label="自定义-" style="width: 20%">自定义
                  <input class="sq"
                         v-model="otherFloors" style="width: 40px"
                         placeholder="请输入层高"/>
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="首层承重" prop="wareFirstLoad">
              <el-input v-model="form.wareFirstLoad" placeholder="请输入首层承重" maxlength="50">
                <template slot="append">kg</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="标准层承重" prop="wareLoad">
              <el-input v-model="form.wareLoad" placeholder="请输入标准层承重" maxlength="50">
                <template slot="append">kg</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">

            <el-form-item label="设施" prop="wareFacili">
              <!--          <el-input v-model="form.wareFacili" placeholder="请输入设施" />-->
              <el-checkbox-group v-model="form.wareFacili" style="width: 100%">
                <el-checkbox
                  v-for="dict in dict.type.storage_facility"
                  :key="dict.value"
                  :label="dict.value">
                  {{ dict.label }}
                </el-checkbox>
                <input class="sq"
                       v-model="otherFacilities" style="width: 80px"
                       placeholder="其它设施"/>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="货梯" prop="wareElevatorCargo">
              <el-radio-group v-model="form.wareElevatorCargo" style="width: 100%">
                <el-radio :label="'有-'">
                  有
                  <input class="sq" style="width: 50px" oninput="value=value.replace(/[^0-9]/g,'')"
                         v-model="otherElevatorCargo"/>
                  部
                </el-radio>
                <el-radio label="无">无</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="货梯负载" prop="wareElevatorCargoLoad">
              <el-input v-model="form.wareElevatorCargoLoad" placeholder="请输入货梯负载" maxlength="50" style="width: 100%">
                <template slot="append">kg</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="消防设施" prop="wareFireControl">
              <el-checkbox-group v-model="form.wareFireControl" style="width: 100%">
                <el-checkbox
                  v-for="dict in dict.type.fire_fighting_device"
                  :key="dict.value"
                  :label="dict.value">
                  {{ dict.label }}
                </el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="应急系统" prop="wareEmergency">
              <el-radio-group v-model="form.wareEmergency" style="width: 100%">
                <el-radio :label="'有-'">
                  有
                  <input class="sq" style="width: 50px" oninput="value=value.replace(/[^0-9]/g,'')"
                         v-model="emergency"/>
                </el-radio>
                <el-radio label="无">无</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="供暖" prop="wareHeating">
              <el-select v-model="form.wareHeating" placeholder="请选择供暖" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.heating_system"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="制冷" prop="wareRefrig">
              <el-select v-model="form.wareRefrig" placeholder="请选择制冷" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.refrigerating_system"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="电量" prop="warePower">
              <el-input v-model="form.warePower" placeholder="请输入电量" style="width: 100%" maxlength="50">
                <template slot="append">度</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="供水" prop="wareWater">
              <el-select v-model="form.wareWater" placeholder="请选择供水" style="width: 100%" maxlength="50">
                <el-option
                  v-for="dict in dict.type.water_system"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="燃气" prop="wareGas">
          <el-radio-group v-model="form.wareGas" style="width: 100%">
            <el-radio
              v-for="dict in dict.type.gas_system"
              :key="dict.value"
              :label="dict.value">
              {{ dict.label }}
            </el-radio>
          </el-radio-group>
          <input v-if="form.wareGas==='其它-'" class="sq" v-model="otherGas" style="width: 20%"
                 placeholder="请输入其它燃气类型"/>
        </el-form-item>


        <!--        <el-form-item label="区域位置" prop="parkAreaAddress">-->
        <!--          <el-input v-model="form.parkAreaAddress" placeholder="请输入区域位置" />-->
        <!--        </el-form-item>-->
        <el-row>
<!--          <el-col :span="24">
            <el-form-item label="关联园区" prop="parkId">
              <el-select v-model="form.parkId" filterable remote placeholder="请输入关联园区"
                         style="width: 100%">
                <el-option v-for="dict in parkList" :key="dict.id"
                           :label="dict.parkName" :value="dict.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>-->
          <el-col :span="24">
            <el-form-item label="所属城市" prop="cityId">
              <el-select v-model="form.provinceId" placeholder="请选择省份" style="width: 50%"
                         @change="getCityList(form.provinceId)" clearable>
                <el-option
                  v-for="dict in provinces"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                />
              </el-select>
              <el-select v-model="form.cityId" placeholder="请选择城市"
                         :disabled="form.provinceId==null||form.provinceId===''"
                         style="width: 50%" clearable>
                <el-option
                  v-for="dict in citys"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <!--        <el-form-item label="浏览量" prop="releaseType">-->
        <!--          <el-input v-model="form.pageView" placeholder="请输入浏览量" />-->
        <!--        </el-form-item>-->
<!--        <el-row>
          <el-col :span="24">
            <el-form-item label="收藏" prop="collectState">
              &lt;!&ndash;          <el-input v-model="form.collectState" placeholder="请输入是否收藏" />&ndash;&gt;
              <el-select v-model="form.collectState" placeholder="是否收藏" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.sys_whether"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="热门推荐" prop="recState">
              &lt;!&ndash;          <el-input v-model="form.recState" placeholder="请输入是否热门推荐" />&ndash;&gt;
              <el-select v-model="form.recState" placeholder="是否热门推荐" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.sys_whether"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="预定状态" prop="reserveState">
              <el-select v-model="form.reserveState" placeholder="请选择预定状态" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.reserve_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="明星推荐状态" prop="recomState">
              <el-select v-model="form.recomState" placeholder="明星推荐" style="width: 100%">
                <el-option
                  v-for="dict in dict.type.sys_whether"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="置顶" prop="top" style="width: 50%">
          <el-select v-model="form.top" placeholder="请选择是否置顶" style="width: 100%">
            <el-option
              v-for="dict in dict.type.sys_whether"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>-->
<!--        <el-form-item label="图片资源" prop="imgResource">
          <image-upload v-model="form.imgResource"/>
        </el-form-item>
        <el-form-item label="封面资源" prop="coverResource">
          <image-upload v-model="form.coverResource" :limit="1"/>
        </el-form-item>
        <el-form-item label="VR封面" prop="vrcover">
          <image-upload v-model="form.vrcover" :limit="1"/>
        </el-form-item>-->
        <el-form-item label="微信二维码" prop="qrCode">
          <image-upload v-model="form.qrCode" :limit="1"/>
        </el-form-item>
<!--        <el-form-item label="VR资源" prop="vrResource">
          &lt;!&ndash;          <file-upload v-model="form.vrResource"/>&ndash;&gt;
          <video-upload v-model="form.vrResource"/>
        </el-form-item>-->

        <el-row>
          <el-col :span="24">
            <el-form-item label="联系人" prop="contactName">
              <el-input v-model="form.contactName" placeholder="请输入联系人" maxlength="50"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <!--        <el-form-item label="联系方式" prop="servicePhone">-->
            <!--          <el-input v-model="form.servicePhone" placeholder="请输入联系方式" />-->
            <!--        </el-form-item>-->
            <el-form-item label="联系方式" prop="contactPhone">
              <el-input v-model="form.contactPhone" placeholder="请输入联系方式" maxlength="50"/>
            </el-form-item>
          </el-col>
        </el-row>
        <!--        <el-form-item label="发布人用户ID" prop="supplyUserId">-->
        <!--          <el-input v-model="form.supplyUserId" placeholder="请输入发布人用户ID" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="审核状态" prop="approvalState">-->
        <!--          <el-input v-model="form.approvalState" placeholder="请输入审核状态：0待审核1审核通过2审核失败" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="审核意见" prop="approvalNote">-->
        <!--          <el-input v-model="form.approvalNote" placeholder="请输入审核意见" />-->
        <!--        </el-form-item>-->
        <el-form-item label="备注" prop="note">
          <el-input v-model="form.note" type="textarea" maxlength="100" show-word-limit placeholder="请输入备注"/>
        </el-form-item>
        <el-form-item >
          <el-alert
            title="初审通过" type="success" center :closable="false" v-if="form.approvalState===1||form.approvalState===3||form.approvalState===4"  show-icon>
          </el-alert>
          <el-alert
            title="初审拒绝" type="error" center :closable="false" v-if="form.approvalState===2"  show-icon>
          </el-alert>
        </el-form-item>
        <el-form-item label="初审意见" prop="approvalNote" v-if="form.approvalState!==0&&form.approvalState!=null">
          <editor v-model="form.approvalNote" :min-height="100"  read-only/>
        </el-form-item>
        <el-form-item>
          <el-alert title="复审通过" type="success" center :closable="false" v-if="form.approvalState===1"  show-icon>
          </el-alert>
          <el-alert title="复审拒绝" type="error" center :closable="false" v-if="form.approvalState===4"  show-icon>
          </el-alert>
        </el-form-item>
        <el-form-item label="复审意见" prop="recheckNote" v-if="form.approvalState===1||form.approvalState===4">
          <editor v-model="form.recheckNote" :min-height="100"  read-only/>
        </el-form-item>
        <!--        <el-form-item label="排序" prop="sort">-->
        <!--          <el-input v-model="form.sort" placeholder="请输入排序" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="状态" prop="state">-->
        <!--          <el-input v-model="form.state" placeholder="请输入状态0有效1失效" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="删除" prop="dr">-->
        <!--          <el-input v-model="form.dr" placeholder="请输入是否删除0否1是" />-->
        <!--        </el-form-item>-->

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 审核 -->
    <el-dialog title="仓库审核" :visible.sync="wareAudit" close-on-click-modal center width="750px">
      <el-form :model="form" label-width="130px">
        <el-form-item label="审核意见" prop="approvalNote">
          <Editor v-model="form.approvalNote" :min-height="100" style="width: 490px"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="success" @click="submitCheck(1)">审核通过</el-button>
        <span style="width: 5%;display: inline-block"></span>
        <el-button type="danger" @click="submitCheck(2)">审核驳回</el-button>
        <span style="width: 5%;display: inline-block"></span>
        <el-button type="info" @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/myIndustry/warehouse";
import {listCity} from "@/api/business/businessIntro";
import {parkList} from "@/api/myIndustry/park";
import VideoUpload from "@/components/VideoUpload";
import MyEditor from "@/components/wangEdiot";

export default {
  name: "Warehouse",
  components: {MyEditor, VideoUpload},
  dicts: ['floor_height','rental_price','selling_price','regional_position','sys_whether', 'storage_facility', 'park_type','announce_type','need_mode', 'industry_orientation', 'economic_belt', 'sys_have_not', 'heating_system', 'supply_type', 'sys_yes_no', 'refrigerating_system', 'gas_system', 'fire_fighting_device', 'water_system','reserve_type'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      //省份
      provinces: [],
      //城市
      citys: [],
      //园区列表
      parkList: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 仓库表格数据
      warehouseList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      wareAudit: false,

      //其它燃气
      otherGas: null,
      //其它层高
      otherFloors:null,
      //其它设施
      otherFacilities:null,
      //其它货梯
      otherElevatorCargo:null,
      //应急系统
      emergency:null,
      acreage:0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        wareName: null,
        supplyType: null,
        wareLeasePrice: null,
        wareSellPrice: null,
        wareAllSize: null,
        workFreeSize: null,
        wareFloor: null,
        wareFloorHeight: null,
        wareFirstLoad: null,
        wareLoad: null,
        wareFacili: null,
        wareElevatorCargo: null,
        wareElevatorCargoLoad: null,
        wareFireControl: null,
        wareEmergency: null,
        wareHeating: null,
        wareRefrig: null,
        warePower: null,
        wareGas: null,
        wareWater: null,
        parkType: null,
        bussEconomic: null,
        parkAreaAddress: null,
        wareNeedSize: null,
        provinceId: null,
        cityId: null,
        releaseType: 1,
        pageView: null,
        collectState: null,
        recState: null,
        reserveState: null,
        recomState: null,
        imgResource: null,
        coverResource: null,
        vrResource: null,
        contactName: null,
        servicePhone: null,
        contactPhone: null,
        supplyUserId: null,
        approvalState: null,
        approvalNote: null,
        parkId: null,
        note: null,
        sort: null,
        state: null,
        dr: null,
        vrcover: null,
        top: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        wareName: [
          {required: true, message: "仓库名称不能为空", trigger: "blur"}
        ],
        supplyType: [
          {required: true, message: "供给类型不能为空", trigger: "blur"}
        ],
        releaseType: [
          {required: true, message: "发布类型不能为空", trigger: "blur"}
        ],
        contactName: [
          {required: true, message: "联系人不能为空", trigger: "blur"}
        ],
        contactPhone: [
          {required: true, message: "联系方式不能为空", trigger: "blur"},
          {
            required: true,
            pattern: /^[1][3,4,5,7,8,9][0-9]{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        // wareAllSize: [
        //   {required: true, message: "建筑总面积不能为空", trigger: "blur"}
        // ],
        cityId: [
          {required: true, message: "所属城市不能为空", trigger: "blur"}
        ],
        // coverResource: [
        //   {required: true, message: "封面资源不能为空", trigger: "blur"}
        // ],
        // imgResource: [
        //   {required: true, message: "图片资源不能为空", trigger: "blur"}
        // ],
        // parkId: [
        //   {required: true, message: "关联园区不能为空", trigger: "blur"}
        // ],
      }
    };
  },
  created() {
    this.getList();
    this.getprovinceList();
  },
  methods: {
    //预览
    handleLook(row) {
      //http://120.46.220.152/#/pages/index/details?id=339&buildType=4&spaceId=dc46adbfb2944da39078f61446cd662f&provinceId=34
      // window.location.href=`http://120.46.220.152/#/pages/news/details?id=`+id
      open(`http://120.46.220.152/#/pages/index/details?id=`+row.id+`&buildType=4&spaceId=` + row.serialNumber + `&provinceId=` + row.provinceId)
    },
    //面积
    handleAcreage(){
      if (this.form.wareAllSize!=null&&this.form.workFreeSize!=null){
        this.acreage = this.form.wareAllSize-this.form.workFreeSize
      }
    },
    /** 查询仓库列表 */
    getList() {
      this.loading = true;
      listWarehouse(this.queryParams).then(response => {
        this.warehouseList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.wareAudit = false;
      this.reset();
    },
    // 表单重置
    reset() {
      //其它燃气
      this.otherGas = null;
      //其它层高
      this.otherFloors = null;
      //其它设施
      this.otherFacilities = null;
      //其它货梯
      this.otherElevatorCargo = null;
      //应急系统
      this.emergency = null;
      this.form = {
        id: null,
        wareName: null,
        supplyType: [],
        wareLeasePrice: null,
        wareSellPrice: null,
        wareAllSize: null,
        workFreeSize: null,
        wareFloor: null,
        wareFloorHeight: null,
        wareFirstLoad: null,
        wareLoad: null,
        wareFacili: [],
        wareElevatorCargo: null,
        wareElevatorCargoLoad: null,
        wareFireControl: [],
        wareEmergency: null,
        wareHeating: null,
        wareRefrig: null,
        warePower: null,
        wareGas: null,
        wareWater: null,
        parkType: null,
        bussEconomic:null,
        parkAreaAddress: null,
        wareNeedSize: null,
        provinceId:null,
        cityId: null,
        releaseType: 1,
        pageView: null,
        collectState: null,
        recState: null,
        reserveState: null,
        recomState: null,
        imgResource: null,
        coverResource: null,
        vrResource: null,
        contactName: null,
        servicePhone: null,
        contactPhone: null,
        supplyUserId: null,
        approvalState: null,
        approvalNote: null,
        parkId: null,
        note: null,
        sort: null,
        state: null,
        dr: null,
        createTime: null,
        updateTime: null,
        vrcover: null,
        top: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.provinceId=null;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      if (this.$store.getters.checkState==='0'){
        this.$message({
          type: 'info',
          message: `用户信息审核中`
        });
        return
      }else if (this.$store.getters.checkState==='2'){
        this.$message({
          type: 'error',
          message: `用户信息审核失败`
        });
        return
      }else if (this.$store.getters.checkState=== '-1'){
        this.$message({
          type: 'info',
          message: `用户信息未提交`
        });
        return
      }
      this.reset();
      this.getparkList();
      this.open = true;
      this.title = "添加仓库";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      this.getparkList();
      // console.log(id)
      getWarehouse(id).then(response => {
        this.form = response.data || {};
        // console.log( this.form )
        if (this.form.supplyType != null) {
          this.form.supplyType = this.form.supplyType.split(",");
        }
        if (this.form.wareFireControl != null) {
          this.form.wareFireControl = this.form.wareFireControl.split(",");
        }
        // console.log("AAA",this.form.wareFacili)
        if (this.form.wareFacili != null) {
          this.form.wareFacili = this.form.wareFacili.split(",");
          //设施
          // console.log("AAA",this.form.wareFacili)
          for (let i = this.form.wareFacili.length - 1; i >= 0; i--) {
            // console.log(i,this.form.wareFacili[i])
            if (this.form.wareFacili[i].indexOf("其它-") !== -1) {
              this.otherFacilities = this.form.wareFacili[i];
              this.otherFacilities = this.otherFacilities.substring(this.otherFacilities.indexOf("其它-") + 3);
              this.form.wareFacili[i] = this.form.wareFacili[i].substring(0, this.form.wareFacili[i].indexOf("其它-") + 3)
              break;
            }
          }
        }
        // console.log("AAA",this.form.wareFacili)
        //燃气
        if (response.data.wareGas!=null&&response.data.wareGas.indexOf("其他-")!==-1){
          this.otherGas = response.data.wareGas
          this.otherGas = this.otherGas.substring(this.otherGas.indexOf("其他-")+3)
          this.form.wareGas = this.form.wareGas.substring(0,this.form.wareGas.indexOf("其他-")+3)
        }
        //层高
        if (response.data.wareFloorHeight!=null&&response.data.wareFloorHeight.indexOf("自定义-")!==-1){
          this.otherFloors = response.data.wareFloorHeight
          this.otherFloors = this.otherFloors.substring(this.otherFloors.indexOf("自定义-")+4)
          this.form.wareFloorHeight = this.form.wareFloorHeight.substring(0,this.form.wareFloorHeight.indexOf("自定义-")+4)
        }
        //货梯
        if (response.data.wareElevatorCargo!=null&&response.data.wareElevatorCargo.indexOf("有-")!==-1){
          this.otherElevatorCargo = response.data.wareElevatorCargo
          this.otherElevatorCargo = this.otherElevatorCargo.substring(this.otherElevatorCargo.indexOf("有-")+2)
          this.form.wareElevatorCargo = this.form.wareElevatorCargo.substring(0,this.form.wareElevatorCargo.indexOf("有-")+2)
        }
        //应急系统
        if (response.data.wareEmergency!=null&&response.data.wareEmergency.indexOf("有-")!==-1){
          this.emergency = response.data.wareEmergency
          this.emergency = this.emergency.substring(this.emergency.indexOf("有-")+2)
          this.form.wareEmergency = this.form.wareEmergency.substring(0,this.form.wareEmergency.indexOf("有-")+2)
        }
        // this.form.wareGas = this.form.wareGas.split(",");
        if (response.data.provinceId!=null){
          listCity(response.data.provinceId).then(res =>{
            this.citys = res.data;
          })
        }
        this.open = true;
        this.title = "修改仓库";
      });
    },
    // async handleUpdate(row) {
    //   this.reset();
    //   const id = row.id || this.ids;
    //   try {
    //     const { data } = await getWarehouse(id);
    //     this.form = data;
    //     // ['approvalNote', 'approvalState', 'wareGas'].forEach(key => {
    //     //   if (typeof this.form[key] === 'string') {
    //     //     this.form[key] = this.form[key].split(',');
    //     //   }
    //     // });
    //     this.open = true;
    //     this.title = "修改仓库";
    //   } catch (error) {
    //     console.error(error);
    //   }
    // },
    /** 审核 */
    spaceAudit(row){
      this.reset();
      this.form.id = row.id
      this.wareAudit = true;
    },
    /** 提交审核 */
    submitCheck(state) {
      updateWarehouse({
        id: this.form.id,
        approvalState: state,
        approvalNote: this.form.approvalNote
      }).then(response => {
        this.$modal.msgSuccess("审核成功");
        this.wareAudit = false;
        this.getList();
      });

    },
    updateRelease(releaseType){
      console.log(releaseType)
      if(this.form.releaseType===0){
        this.form.wareNeedSize = null;
      }else {
        this.form.workFreeSize = null;
        this.form.wareAllSize = null;
      }
    },
    /** 提交按钮 */
    submitForm() {
      if (this.acreage<0){
        this.$alert('还有未处理的警告，请处理完相关问题后提交', '警告', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `处理完相关问题后再提交`
            });
          }
        })
        return
      }
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.wareGas === "其他-" && (this.otherGas == null||this.otherGas==='')) {
            this.$modal.msgError("请输入其他燃气种类");
            return;
          }
          if (this.form.wareFloorHeight === "自定义-" && (this.otherFloors == null||this.otherFloors ==='')) {
            this.$modal.msgError("请输入其他层高");
            return;
          }
          if (this.form.wareElevatorCargo === "有-" && (this.otherElevatorCargo == null||this.otherElevatorCargo==='')) {
            this.$modal.msgError("请输入货梯数量");
            return;
          }
          if (this.form.wareEmergency === "有-" && (this.emergency == null||this.emergency==='')) {
            this.$modal.msgError("请输入应急设备种类");
            return
          }
          //设施
          for (let i = this.form.wareFacili.length - 1; i >= 0; i--) {
            if (this.form.wareFacili[i] === "其它-") {
              if (this.otherFacilities==null||this.otherFacilities===''){
                this.$modal.msgError("请输入其他设施种类");
                return;
              }else {
                this.form.wareFacili[i] = this.form.wareFacili[i] + (this.otherFacilities != null ? this.otherFacilities : '')
                break;
              }
            }
          }
          this.form.supplyType = this.form.supplyType.join(",");
          this.form.wareFireControl = this.form.wareFireControl.join(",");
          this.form.wareFacili = this.form.wareFacili.join(",");
          //燃气
          if (this.form.wareGas === "其他-") {
            this.form.wareGas = this.form.wareGas + this.otherGas
          }
          //层高
          if (this.form.wareFloorHeight==="自定义-"){
            this.form.wareFloorHeight = this.form.wareFloorHeight + this.otherFloors
          }
          //货梯
          if (this.form.wareElevatorCargo==="有-"){
            this.form.wareElevatorCargo = this.form.wareElevatorCargo + this.otherElevatorCargo
          }
          //应急系统
          if (this.form.wareEmergency==="有-"){
            this.form.wareEmergency = this.form.wareEmergency + this.emergency
          }
          // this.form.approvalState = 0
          if (this.form.id != null) {
            updateWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addWarehouse(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除仓库编号为"' + ids + '"的数据项？').then(function() {
        return delWarehouse(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('industry/frontend/warehouse/export', {
        ...this.queryParams
      }, `warehouse_${new Date().getTime()}.xlsx`)
    },
    /** 查询省份列表*/
    getprovinceList(){
      var parentId = 0;
      listCity(parentId).then(res =>{
        // console.log("AAA",res)
        this.provinces = res.data;
      })
    },
    //查询市列表
    getCityList(provinceId) {
      // console.log("BBB",provinceId)
      listCity(provinceId).then(res =>{
        this.citys = res.data;
      })
      this.queryParams.cityId=null;
      this.form.cityId = null;
      this.form.areaId = null;
    },
    //获取园区id
    getparkList(){
      parkList().then(res=>{
        // console.log(res)
        this.parkList = res.data;
      })
    }
  }
};
</script>
<style scoped>
.sq {
  width: 25px;
  margin: 0 10px;
  border: none;
  border-bottom: 1px solid;
}
/*.el-input__inner{*/
/*  width: 250px;*/
/*}*/
/*.float-centered{*/
/*  display: flex;*/
/*  justify-content: stretch;*/
/*  flex-wrap: wrap;*/
/*  margin-left: 253px;*/
/*}*/
/*.el-dialog__body {*/
/*  display: flex;*/
/*  justify-content: center;*/
/*}*/
/*.el-form-item {*/
/*  margin-top: 20px;*/
/*}*/
/*.pagination-container[data-v-72233bcd] {*/
/*  display: flex;*/
/*  justify-content: center;*/
/*}*/
/*.el-form-item {*/
/* width: 600px;*/
/*}*/
</style>
